package cn.com.main;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;

import cn.hutool.core.date.DateTime;

public class TimeConversion {


    public static void main(String[] args) {
        // 原始账单时间
        DateTime billTime = new DateTime();
        LocalDateTime originalBillTime = billTime.toLocalDateTime();
        System.out.println("原始账单时间: " + originalBillTime);

        // 系统默认时区
        ZoneId systemDefaultZone = ZoneId.systemDefault();
        System.out.println("系统默认时区: " + systemDefaultZone);

        // 各个时区
        ZoneId[] zoneIds = {
                ZoneOffset.UTC,
                ZoneId.of("GMT"),
                ZoneId.of("America/Los_Angeles"),
                ZoneId.of("America/New_York"),
                ZoneId.of("Asia/Shanghai"),
                ZoneId.of("Europe/London"),
                ZoneId.of("Australia/Sydney")
        };

        for (ZoneId zoneId : zoneIds) {
            ZonedDateTime zonedDateTime = originalBillTime.atZone(systemDefaultZone).withZoneSameInstant(zoneId);
            System.out.println(zoneId + " 调整后的账单时间: " + new DateTime(zonedDateTime.toLocalDateTime()));
        }
    }

}
